/**
 * BeautifyData.java
 */
package com.pluginsacceptor.plugin.beautify.model;

import java.util.ArrayList;
import java.util.List;

/**
 * The class contains cell list with beautify data
 */
public class BeautifyData {

    /** */
    private final CellList cellList = new CellList();

    /** */
    private final List<String> colorNames = new ArrayList<String>();

    /** */
    private final List<String> fontTypes = new ArrayList<String>();

    /**
     * Added cell list to common storage
     * @param newCellList the new cell list
     * @param colorName the applicable parameter (color)
     * @param fontType the applicable parameter (font type)
     */
    public void add(final CellList newCellList, final String colorName, final String fontType) {
        final List<Integer> rows = newCellList.getRows();
        final List<Integer> cols = newCellList.getColumns();
        final int size = rows.size();

        for (int cnt = 0; cnt < size; cnt++) {
            add(rows.get(cnt), cols.get(cnt), colorName, fontType);
        }
    }

    /**
     * Added cell list to common storage
     * @param newCellList the new cell list
     * @param fontType the applicable parameter (font type)
     * @param colorName the applicable parameter (color)
     */
    public void add(final int row, final int col, final String fontType, final String colorName) {
        if (cellList.contains(row, col)) {
            final int index = cellList.getRows().indexOf(row);
            colorNames.set(index, colorName);
            fontTypes.set(index, fontType);
        } else {
            cellList.add(row, col);
            colorNames.add(colorName);
            fontTypes.add(fontType);
        }
    }

    /**
     * Clear all data
     */
    public void clear() {
        this.cellList.clear();
        this.colorNames.clear();
        this.fontTypes.clear();
    }

    /**
     * @return the cellLists
     */
    public CellList getCellList() {
        return cellList;
    }

    /**
     * @return the colorNames
     */
    public List<String> getColorNames() {
        return colorNames;
    }

    /**
     * @return the fontTypes
     */
    public List<String> getFontTypes() {
        return fontTypes;
    }
}
